<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>旅行社列表</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="/static/layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="/static/layuiadmin/style/admin.css" media="all">
    <style>
        #guide_ul li{
            margin-top: 15px;
        }
        .layui-hide{  /*最后的pic为字段的field*/
            height: 100%;
            max-width: 100%;
        }
        .layui-table-cell{
            height:auto !important;
        }
    </style>
</head>
<body>
<div id="aaa"></div>
<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-header">旅行社列表</div>
                <div class="layui-card-body">

                    <table class="layui-hide" id="test-table-operate" lay-filter="test-table-operate">
                    </table>
                    <script type="text/html" id="test-table-operate-barDemo">
                        <a class="layui-btn layui-btn-green layui-btn-xs" lay-event="edit">完善信息</a>
                    </script>
                </div>
            </div>
        </div>
    </div>
</div>

<div id="contentShow" style="display:none;padding: 30px;">
    <p id="consultation"></p>
</div>

<script src="/static/layuiadmin/layui/layui.js"></script>
<script>
    layui.config({
        base: '/static/layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index','form','table','laydate','set'], function(){
        $ = layui.jquery;
        var table = layui.table
            ,admin = layui.admin
            ,element = layui.element
            ,layer = layui.layer
            ,laydate = layui.laydate
            ,form = layui.form;

        table.render({
            elem: '#test-table-operate'
            ,url: "{:url('Info/info')}"
            ,height: 'full-100'
            ,cols: [[
                {field:'team_id',width:80,align:'center', title: 'ID'}
                ,{field:'team_name',align:'center',title: '旅行社名称'}
                ,{field:'team_icon', align:'center', title: '旅行社头像',style:"height:100px;",templet:function(d){
                        return "<img src=" +d.team_icon+ ">"}}
                ,{field:'team_background', align:'center', title: '旅行社背景图',style:"height:100px;",templet:function(d){
                        return "<img src=" +d.team_background+ ">"}}
                ,{field:'team_phone',align:'center',title: '旅行社电话'}
                 ,{field:'team_address', align:'center', title: '旅行社地址',templet:function (d) {
                        return d.city+d.team_address
                    }}
                ,{field:'time', align:'center', title: '旅行社营业时间'}

                ,{align:'center',width:200, title: '操作', toolbar: '#test-table-operate-barDemo'}
            ]]
            ,page:true
            ,limit:20
        });

        form.render(null,'component-form-group');

        laydate.render({
            elem: '#search_time'
        });

        //监听工具条
        table.on('tool(test-table-operate)', function(obj){
            var data = obj.data;
             if(obj.event === 'editPassword'){
                $('#editPasswordUid').val(data.t_admin_id);
                var editpassmodal = layer.open({
                    title:'修改商户密码'
                    ,type: 1
                    ,shadeClose: true
                    ,area: admin.screen() < 2 ? ['60%'] : ['500px']
                    ,content: $('#editpassmodal')
                });
            }else if(obj.event === 'edit'){
                window.location.href="{:url('Info/editInfo')}?id=" + data.team_id;
            }

        });

        var $ = layui.$, active = {

            searchUserButton:function(){
                var team_name  = $('#team_name').val();
                var team_phone = $('#team_phone').val();


                table.reload('test-table-operate', {
                    where: {
                        team_name:team_name,
                        team_phone: team_phone,

                    }
                    ,page: {
                        curr: 1 //重新从第 1 页开始
                    }
                });
                //return false;
            }
        };
        //绑定点击事件
        $('.test-table-operate-btn .layui-btn').on('click', function(){
            var type = $(this).data('type');
            active[type] ? active[type].call(this) : '';
        });

    });

</script>


</body>
</html>